package com.tj.collection.db.dao.impl;

import com.fqgj.common.base.AbstractBaseMapper;
import com.tj.collection.db.dao.ClOutboundBatchDao;
import com.tj.collection.db.entity.ClOutboundBatchEntity;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * User: Karl
 * Date: 2020-02-25
 * Time: 17:10:20.139
 */

@Repository
public class ClOutboundBatchDaoImpl extends AbstractBaseMapper<ClOutboundBatchEntity> implements ClOutboundBatchDao {

    @Override
    public List<ClOutboundBatchEntity> selectClOutboundBatchListByParams(Map<String, Object> params) {
        if (!params.containsKey("deleted")) {
            params.put("deleted", 0);
        }
        return getSqlSession().selectList(this.getStatement("selectByParams"), params);
    }

    @Override
    public ClOutboundBatchEntity selectClOutboundBatchByBatchName(String batchNo) {
        Map<String, Object> params = new HashMap<>();
        params.put("batchNo", batchNo);
        List<ClOutboundBatchEntity> list = this.selectClOutboundBatchListByParams(params);
        if (list != null && list.size() > 0) {
            return list.get(0);
        } else {
            return null;
        }
    }

}